#pragma once

#include <iostream>
#include <unistd.h>
#include <cstring>
#include <cassert>
#include <vector>
#include <functional>
#include <sys/wait.h>
#include <sys/types.h>

#define TASK_NUM 3

using func = std::function<void(void)>;

void Mysql()
{
    std::cout << "PID : " << getpid() <<  " MySQL is running......." << std::endl;
}

void Print()
{
    std::cout << "PID : " << getpid() << " Printing........." << std::endl;
}

void Calculate()
{
    std::cout << "PID : " << getpid() << " Calculate........." << std::endl;
}

class Task
{
public:
    Task()
    {
        funcs.push_back(Mysql);
        funcs.push_back(Print);
        funcs.push_back(Calculate);
    }
    void Excute(int taskid)
    {
        if (taskid >= 0 && taskid < funcs.size())
            funcs[taskid]();
    }
    ~Task() {}

public:
    std::vector<func> funcs;
};